import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import * as API from '@/api';

import '@/mock/serve';
import 'swiper/css/swiper.css';

//注册全局导航栏
import TypeNav from '@/components/TypeNav';
Vue.component(TypeNav.name, TypeNav);
//注册全局轮播图
import Carousel from '@/components/Carousel';
Vue.component(Carousel.name, Carousel);
//注册全局分页器
import Pagination from '@/components/Pagination';
Vue.component(Pagination.name, Pagination);

Vue.config.productionTip = false;

//引入element-ui组件
import {
  Button,
  MessageBox
} from 'element-ui';
Vue.use(Button);

//引入图片懒加载
import VueLazyload from 'vue-lazyload';
import gif from '@/assets/1.gif';
Vue.use(VueLazyload, {
  loading: gif
});

//引入表单验证插件
import '@/plugins/validate';

new Vue({
  router,
  store,
  beforeCreate() {
    //全局事件总线
    Vue.prototype.$bus = this;
    //全局api请求
    Vue.prototype.$API = API;
    //注册弹框组件
    Vue.prototype.$msgbox = MessageBox;
    Vue.prototype.$alert = MessageBox.alert;

  },
  render: h => h(App),
}).$mount('#app')